package com.scaffold.myproject.web.mq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import com.scaffold.myproject.constants.MQConstants;

@Slf4j
@Component
@RocketMQMessageListener(topic = MQConstants.TOPIC_USER, consumerGroup = "my_consumer_group", selectorExpression = MQConstants.TAG_USER)
public class RocketMQConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        log.info("收到消息，topic={}, tag={}, msg={}", MQConstants.TOPIC_USER, MQConstants.TAG_USER, message);
    }
}
